﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Ahi.Controller;

namespace Ahi.Base
{
    public partial class RaporKriterForm : BaseForm
    {
        Type type;

        public List<ISorgulanabilir> KriterListesi
        {
            get
            {
                return (List<ISorgulanabilir>)bsKriter.DataSource;
            }
        }

        public RaporKriterForm(Type type)
        {
            InitializeComponent();
            this.type = type;
        }

        public override void Hazirla()
        {
            repositoryItemLookUpKriter.SetEnumList<Ahi.Entity.Enums.SorgulamaKriterleri>();
        }

        private void editKriterVar_CheckedChanged(object sender, EventArgs e)
        {
            if (editKriterVar.Checked)
            {
                editKriterYok.Checked = false;
                KriterleriUret();
            }
        }

        private void KriterleriUret()
        {
            KriterUreticiController cont = new KriterUreticiController(gridView1);
            bsKriter.DataSource = cont.Uret(type);
        }

        private void editKriterYok_CheckedChanged(object sender, EventArgs e)
        {
            if (editKriterYok.Checked)
            {
                editKriterVar.Checked = false;
                gridControl1.Enabled = false;
            }
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }
    }
}
